var mongoose=require('mongoose');
mongoose.connect('mongodb://localhost/DBRef');

var User=mongoose.model('User',{
    name:String
});

var News=mongoose.model('News',{
    title:String,
    author:{
        type:mongoose.Schema.ObjectId,
        ref:'User'
    },
    comments:[{
        content:String
    }]
});

//test
var title='News d';

News.update({title:title},{$pull:{
    comments:{content:/c d \d/}
}},(err,r)=>{
    console.log(err,r);
})